<?php
error_reporting(0);
$isadmin=1;    
include '../comm/config.php';	
include 'check.php';

$path = DDROOTPATH.'/data/phpwindapi.php';
if ($_POST) {
    if (substr(trim($_POST['phpdomain']), -1) == '/') {
        $_POST['phpdomain'] = substr_replace(trim($_POST['phpdomain']), '', -1);
    }
    $_POST['pwd'] = trim($_POST['pwd']);
    $content = '<?php exit; ?>';
    $content .= serialize($_POST);
	if(UC==1){
	    $msg = '您的UC整合正处于开启状态，请先关闭UC整合！';
	}
	else{
	    file_put_contents($path, $content);
        $msg = '设置保存成功！';
	}
}
$content = file_get_contents($path);
$content = str_replace('<?php exit; ?>', '', $content);
$post = unserialize($content);
$ron = '';
$roff = '';
if ($post['open'] == 'on') {
    $ron = 'checked';
} elseif ($post['open'] == 'off' || $post['open'] == '') {
    $roff = 'checked';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="images/arrow.gif" width="16" height="22" align="absmiddle" />phpwind整合设置</strong></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><form method="post" action="">
                    <table width="100%"  align="center" border=1 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor="#dddddd">
                      <?php if($msg!=''){?>
					<tr>
                        <td height="20" colspan="3"><b style="color:#F00"><?php echo $msg;?></b></td>
                        </tr>
                      <tr>
				      <?php }?>
                      <tr>
                        <td width="200" height="30" align="right" class="bigtext">是否开启与phpwind的整合：</td>
                        <td height="30" class="bigtext">&nbsp;
                          <label><input type="radio" name="open" value="on" <?php echo $ron; ?>/>开启</label>  <label><input type="radio" name="open" value="off" <?php echo $roff; ?>/>关闭</label>
                        (注意，如果你不打算与phpwind整合，这里必须选择不开启，phpwind与UC不能同时开启)
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">phpwind网站的首页地址：</td>
                        <td width="" height="30" class="bigtext">&nbsp;
                          <input type="text" name="phpdomain" value="<?php echo $post['phpdomain']; ?>" />                          
                          (例如：http://bbs.domain.com 或 http://www.domain.com/forum，请不要在后面加/index.php之类的后缀 )
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">与phpwind之间共享的通信密钥：</td>
                        <td width="" height="30" class="bigtext">&nbsp;
                          <input type="text" name="pwd" value="<?php echo $post['pwd']; ?>" />                          
                          (请输入长度小于40的，不包含特殊字符“\”，“'”，“"”的任意字符串，本密钥必须于phpwind后台设置的一样)
                        </td>
                      </tr>
                      <tr>
                        <td height="30" align="right">&nbsp;</td>
                        <td height="30" class="bigtext">&nbsp;
                          <input type="submit" name="Submit" value=" 保 存 设 置 " /> 
                          &nbsp;&nbsp;&nbsp;</td>
                      </tr>
                    </table>
                    <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="20" colspan="3">&nbsp;</td>
                        </tr>
                      <tr>
                        <td height="31" colspan="3"><strong>其他说明：</strong></td>
                      </tr>
                      <tr>
                        <td height="36" colspan="3">
                    1、本插件可以与utf8版的phpwind8.7整合<br/>
                    2、如果启用本插件，将不能再使用Ucenter1.6，请把它关闭<br/>
                    3、您可以导入phpwind的会员数据，请点击<a href="getphpwinduser.php"><font color="red">导入会员</font></a>,按要求操作即可
                         </td>
                      </tr>
                    </table>
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>
<?php mysql_close();?>
